
from redis import StrictRedis


class Config(object):

    DEBUG = None
    SECRET_KEY = 'GSNxuzTKlqXCjRbFPF0FSRfr3JMpCO0FPzN1xJdLB1oYtLACmZxshw=='

    # 设置session信息存储在redis数据库中
    SESSION_TYPE = 'redis'
    SESSION_REDIS = StrictRedis(host='127.0.0.1', port=6379)
    # 设置签名
    SESSION_USE_SIGNER = True
    # 设置过期时间
    PERMANENT_SESSION_LIFETIME = 60 * 60 * 24

    # 配置mysql数据库的连接
    SQLALCHEMY_DATABASE_URI = 'mysql://root:mysql@localhost/xj33'
    # 配置动态追踪修改，关闭警告信息
    SQLALCHEMY_TRACK_MODIFICATIONS = False


# 定义开发模式下的配置
class DevelopmentConfig(Config):
    DEBUG = True

# 定义生产模式下的配置
class ProductionConfig(Config):
    DEBUG = False

# 定义字典，存储两种模式
config_dict = {
    'development':DevelopmentConfig,
    'production':ProductionConfig
}